#!/usr/bin/php -q
<?
$server=$argv[1];
$tailfile               = $argv[2];
$check_delay    = $argv[3];

include(dirname(__FILE__)."/tail.lib.php");       // PHP Tail class.
include(dirname(__FILE__)."/syslog.lib.php");       // PHP Syslog class.

$syslog = new Syslog(22, 6);
$t = new TailFile($tailfile);
while ($t->isOpen())
{
        $t->checkUpdates();
        $myres = $t->getResults();

        if ($myres){
                $syslog->Send($server, "SECUREMSG:$myres");
        }
        $t->wait($check_delay);
}
